﻿using System;
using System.Collections.Generic;
using Web.Models.VersionData;

namespace Web.ViewModel.VersionData
{
    public class VersionLibModel
    {
        public Guid Id { get; set; }

        /**
        * 简称
        */
        public String ShortName { get; set; }

        /// <summary>
        /// 项目名
        /// </summary>
        public String ProjectName { get; set; }

        /// <summary>
        ///  程序库描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        ///  当前版本
        /// </summary>
        public string LatestVersion { get; set; }

        /// <summary>
        ///  更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }

        public VersionLibModel()
        {

        }

        public static VersionLibModel ConvertModel(VersionLib versionLib)
        {
            return new VersionLibModel()
            {
                Id=versionLib.Id,
                ShortName = versionLib.ShortName,
                ProjectName = versionLib.ProjectName,
                LatestVersion = versionLib.LatestVersion,
                UpdateTime = versionLib.UpdateTime,
                Description = versionLib.Description
            };
        }

        public static VersionLib ToEntity(VersionLibModel versionLibModel)
        {
            return new VersionLib()
            {
                Id = versionLibModel.Id,
                ShortName = versionLibModel.ShortName,
                ProjectName = versionLibModel.ProjectName,
                LatestVersion = versionLibModel.LatestVersion,
                UpdateTime = versionLibModel.UpdateTime,
                Description = versionLibModel.Description
            };
        }
    }

    



}
